/*
Copyright (c) [2019??5??1??] [??]
[MBT_studio] is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
		 http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
See the Mulan PSL v2 for more details.
*/
#pragma once


struct S_骨骼属性 {
	vec4 A端平面;
	vec4 B端平面;
	vec4 骨骼中间平面;
	vec3 骨骼方向;
	vec3 变换后中点;
	float32 骨骼长度;
};



float32 f_bone_B端权重计算(const vec3& 端坐标
					, const vec3& 方向
					, const vec3& 顶点
					, const std::vector<uint16>& 顶点所属骨骼
					, const S_骨骼属性* 骨骼属性
					//, const float32* 骨骼长度
					//, float32 骨头一半长度
					, float32 顶点到骨骼距离
					, int32 当前骨骼ID
					, S_骨骼邻接数组* 邻接骨骼
					);


float32 f_bone_A端权重计算(const vec3& 端坐标
					  , const vec3& 方向
					  , const vec3& 顶点
					  , const std::vector<uint16>& 顶点所属骨骼
					  , const S_骨骼属性* 骨骼属性
					  //, const float32* 骨骼长度
					  //, float32 骨头一半长度
					  , float32 顶点到骨骼距离
					  , int32 当前骨骼ID
					  , S_骨骼邻接数组* 邻接骨骼
);


float32 f_bone_A端邻接权重计算(const vec3& 顶点, const S_骨骼属性* 骨骼属性, float32 顶点到骨骼距离, int32 当前骨骼ID);

float32 f_bone_B端邻接权重计算(const vec3& 顶点, const S_骨骼属性* 骨骼属性, float32 顶点到骨骼距离, int32 当前骨骼ID);



float32 f_bone_外围权重计算(
						//const vec3& 端坐标
						//, const vec3& 方向
						const vec3& 顶点
						, const std::vector<uint16>& 顶点所属骨骼
						, const S_骨骼属性* 骨骼属性
						//, const float32* 骨骼长度
						, float32 骨头一半长度
						, float32 顶点到骨骼距离
						, int32 当前骨骼ID
							
						, S_骨骼邻接数组* 邻接骨骼
						, float32 pd
);


float32 f_bone_外围邻接权重计算(//const vec3& 端坐标
							  //, const vec3& 方向
							  const vec3& 顶点
							  , float32 pd
							  , float32 骨头长度
							  , float32 顶点到骨骼距离
							  //, int32 当前骨骼ID
);


void f_bone_当前顶点最短骨骼(float32& 最小距离
				, int32& 最近骨骼ID
				, const std::vector<uint16>& 顶点所属骨骼
				, const S_骨骼属性* 骨骼属性
				, int32 当前骨骼ID
				);


void f_bone_最短骨骼(float32& 最小距离
				, int32& 最近骨骼ID
				, const S_骨骼属性* 骨骼属性
				, const S_I32Array* 邻接骨骼
);










